import { IArticleItem, IArticleRes } from '@/api/article/type';
import { http } from '@/core/http';

/**
 * 查询首页文章列表
 * @param params
 */
export const getArticleList = (params?: {
    pageSize?: number;
    pageNum?: number;
}) => {
  return http.get<IArticleRes>({
    url: '/article/list',
    params,
    isLoading: false
  });
};
/**
 * 文章详情
 * @param uid
 */
export const getArticleItemDetailById = (uid: string) => {
  return http.get<IArticleItem>({
    url: `/article/detail/${uid}`
  });
};
/**
 * 根据文章uid查询作者近期文章
 * @param uid
 */
export const getArticleRecentByUid = (uid: string) => {
  return http.get<IArticleItem[]>({
    url: `/article/author/recent/${uid}`
  });
};

/**
 * 首页最近文章
 */
export const getArticleRecent = () => {
  return http.get<IArticleItem[]>({
    url: '/article/recent',
    isLoading: false
  });
};
